"use server";
import { GroupType } from "@/api/home";
import { server } from "@/utils/server";
import dynamic from "next/dynamic";

const HomeTabs = dynamic(() => import("./_home/HomeTabs"));

const TIME = 0;
const getGames = async () => {
    return server
        .request<GroupType[]>({
            url: "/v1/api/front/game_list",
            method: "POST",
            next: { revalidate: TIME },
        })
        .then((res) => {
            if (res.code === 200) return res.data;
            return [];
        });
};

export default async function Page() {
    const group = await getGames();

    return (
        <>
            <HomeTabs tabs={group} />
        </>
    );
}
